package com.springboot.dubbo.consumer.filter;

import com.alibaba.dubbo.common.Constants;
import com.alibaba.dubbo.common.extension.Activate;
import com.alibaba.dubbo.rpc.*;

import java.util.Map;

/**
 * @Author: guodong
 * @Date: 2020/12/30 13:35
 * @Version: 1.0
 * @Description:
 */

@Activate(group = {Constants.CONSUMER, Constants.PROVIDER})
public class DubboConsumerFilter implements Filter {


    @Override
    public Result invoke(Invoker<?> invoker, Invocation invocation) throws RpcException {
        Map<String, String> context = RpcContext.getContext().getAttachments();
        context.put("name", "guodong");
        context.put("age", "3233");
        return invoker.invoke(invocation);
    }


}
